package com.wss.common.widget;

import ohos.aafwk.content.Intent;
import ohos.agp.components.AttrSet;
import ohos.agp.components.Component;
import ohos.agp.components.ListContainer;
import ohos.app.Context;

/**
 * 不可滑动的ListView
 *
 * @author 杨伟
 * create by 2020-4-17
 */
public class NoScrollListView extends ListContainer
        implements Component.EstimateSizeListener {

    public NoScrollListView(Context context) {
        super(context);
    }

    public NoScrollListView(Context context, AttrSet attrSet) {
        super(context, attrSet);
    }

    public NoScrollListView(Context context, AttrSet attrSet, String styleName) {
        super(context, attrSet, styleName);
        setEstimateSizeListener(this);
    }

    @Override
    public boolean onEstimateSize(int widthEstimateConfig,
                                  int heightEstimateConfig) {

        int expandSpec = EstimateSpec.getSizeWithMode(Integer.MAX_VALUE >> 2,
                EstimateSpec.NOT_EXCEED);

        setEstimatedSize(widthEstimateConfig, expandSpec);

        return true;
    }
}
